<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/loginAndRegister.css">
    <script type="text/javascript" src="../layui/layui.all.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
 	<script type="text/javascript" src="../js/jquery-2.2.3.min.js"></script> 
	<link rel="stylesheet" href="../css/layer-animate.css"/> 
	<script type="text/javascript" src="../js/regular.js"></script>
</head>
<body>
<div class="layui-bg-blue" id="top"><a href="http://localhost:8080/index.html">欢迎使用瑜伽APP</a></div>
	
	<div class="layui-tab layui-tab-brief" lay-filter="demo">
  <ul class="layui-tab-title">
    <li class="layui-this">手机找回</li>
    <li>邮箱找回</li>
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">		
	 <div id="login">通过手机找回密码</div>
	  <div class="centerBox">
	<input type="text"  placeholder="请输入账号" id="phone" onkeyup="phoneCheck()"/>
	<p><span id="judge1"></span></p>
	<button onclick="sendMessage()" type="button">点击获取验证码</button>
	<input type="text"  placeholder="请输入验证码" id="Code1"/>  
	  <button  onclick="loginByPhone()" type="button" id="button1">确定</button>	   
	  </div>

	</div>
    <div class="layui-tab-item">
	  <div id="login">通过邮箱找回密码</div>
	  <div class="centerBox">
	  <input type="text" id="mail" name="mail" placeholder="请输入账号" onkeyup="ischeckemail()"/>
	 	<p><span id="judge2"></span></p>  
		<button onclick="sendMail()" type="button">点击获取验证码</button>
	  <input type="text" placeholder="请输入验证码" id="Code2"/>
	  <button  onclick="loginByMail()" type="button" id="button3">确定</button>
	  
	</div>
  </div>
</div>
</div>
</body>
<script type="text/javascript">
function sendMessage(){
	$.ajax({
		url:"/user/creatYZM",
		type:"post",
		data:{
			phoneNum:$("#phone").val()
		},
		success:function(data){
			alert("验证码发送中");
		}
	});
}
function sendMail(){
	$.ajax({
		url:"/user/sendMail",
		type:"post",
		data:{
			mail:$("#mail").val()
		},
		success:function(data){
			alert("验证码发送中");
		}
	});
}
function loginByPhone(){
	$.ajax({
		url:"/user/judgeCode",
		type:"post",
		data:{
			uphone:$("#phone").val(),
			code:$("#Code1").val()
		},
		success:function(data){
			alert(data);
			if(data.indexOf("成功")!=-1){
				location.href="http://localhost:8080/jsp/findPwdByPhone.jsp?abc="+$("#phone").val();
			}
		}
	});
}
function loginByMail(){
	$.ajax({
		url:"/user/judgeCode",
		type:"post",
		data:{
			uamil:$("#mail").val(),
			code:$("#Code2").val()
		},
		success:function(data){
			alert(data);
			if(data.indexOf("成功")!=-1){
				location.href="http://localhost:8080/jsp/findPwdByPhone.jsp?abc="+$("#mail").val();
			}
		}
	});
}
</script>
</html>